/**
 * Project Name:springmvc
 * File Name:DateJsonSerializer.java
 * Package Name:com.pango.core.paginator.json
 * Date:May 12, 20145:49:40 PM
 * Copyright (c) 2014, fuqiongsong@gmail.com All Rights Reserved.
 *
*/

package com.pango.core.paginator.json;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * ClassName:DateJsonSerializer <br/>
 * Date:     May 12, 2014 5:49:40 PM <br/>
 * @author   thierry.fu
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
public class DateJsonSerializer extends JsonSerializer<Date> {
	@Override
	public void serialize(Date date, JsonGenerator jgen, SerializerProvider provider)
			throws IOException, JsonProcessingException {
		// TODO Auto-generated method stub
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		jgen.writeString(sdf.format(date));
	}
}
